import request from "@/util/request"

/**
 * 获取角色卡列表
 * @returns {Promise} 角色卡列表
 */
export const getCharacterCards = () => {
  return request({
    url: "/character/cards",
    method: "get"
  });
};

/**
 * 获取角色卡列表,通过名称准确搜索
 * @returns {Promise} 角色卡列表
 */
export const getCharacterCardsByName = (name) => {
  return request({
    url: `/character/cards/name/${name}`,
    method: "get"
  });
};

/**
 * 获取角色卡列表,启用状态
 * @returns {Promise} 角色卡列表
 */
export const getCharacterCardsByEnable = () => {
  return request({
    url: "/character/cards/enable",
    method: "get"
  });
};



/**
 * 获取指定角色卡详情
 * @param {string} id 角色卡ID
 * @returns {Promise} 角色卡详情
 */
export const getCharacterCardDetail = (id) => {
  return request({
    url: `/character/cards/characterId/${id}`,
    method: "get"
  })
}
/**
 * 创建角色卡
 * @param {Object} data 角色卡数据
 * @returns {Promise} 创建结果
 */
export const createCharacterCard = (data) => {
  return request({
    url: "/character/cards",
    method: "post",
    data
  })
}

/**
 * 更新角色卡
 * @param {Object} data 角色卡数据
 * @returns {Promise} 更新结果
 */
export const updateCharacterCard = (character_card_id, data) => {
  return request({
    url: `/character/cards/${character_card_id}`,
    method: "put",
    data
  })
}

/**
 * 禁用角色卡
 * @param {string} id 角色卡数据
 * @returns {Promise} 更新结果
 */
export const bandCharacterCard = (character_card_id) => {
  return request({
    url: `/character/cards/band/${character_card_id}`,
    method: "put"
  })
}


/**
 * 启动角色卡
 * @param {string} id 角色卡数据
 * @returns {Promise} 更新结果
 */
export const startCharacterCard = (character_card_id) => {
  return request({
    url: `/character/cards/start/${character_card_id}`,
    method: "put"
  })
}

/**
 * 删除角色卡
 * @param {string} id 角色卡ID
 * @returns {Promise} 删除结果
 */
export const deleteCharacterCard = (id) => {
  return request({
    url: `/character/cards/${id}`,
    method: "delete"
  })
}
